package com.moxiu.browser.util;

public interface BrowserAdblock {
	public static final String TAG = "ad_block";
	public static final String BROWSER_ADBLOCK_HTMLSOURCE = "javascript:window.local_obj.showSource()'<head>'+document.getElementByTagName('html')[0].innerHTML+'</head>');";
	public static final String[] ADBLOCK_BAIDU_REGULAR = {
			"(cpro(2)?|wn\\.pos|pos|bdimg\\.share)\\.baidu(static)?\\.com",
			"img0\\.bdstatic\\.com/img/image/%E9%BB%91%E5%BA%95%E5%8D%8A%E9%80%8F0902%E6%96%B0%E7%89%88", 
			"ujian\\.cc",
			"pagead2\\.googlesyndication\\.com"};
	public static final String ADBLOCK_360DC_REGULAR = "(w+)\\.360doc\\.cn\\/images\\/(a1|a2)\\.png\\?t=(11|22)";

	public static final String[] ADBLOCK_JS = {
			"javascript:document.getElementById('AdPromote').style.display = 'none';",
			"javascript:document.getElementById('search-appPromote').style.display = 'none';",
			"javascript:document.getElementById('mediacypromote').parentNode.removeChild(document.getElementById('mediacypromote'));",
			"javascript:document.getElementsByClassName('lanmu_di')[0].parentNode.removeChild(document.getElementsByClassName('lanmu_di')[0]);",
			"javascript:document.getElementsByClassName('_topbar')[0].remove();document.getElementsByClassName('_topbar')[1].remove();"};

	// 显示网页html源码
	public void showSource(String html);

	// 广告屏蔽开关控制
	public void adblockControl(Boolean isOpen);

	// 广告url地址匹配
	public boolean adUrlMatching(String url);

	// 通过js注入屏蔽广告
	public String[] adBlockByJs();
}
